<!--
 * @Author: DUST
 * @Date: 2023-06-28 15:13:17
 * @LastEditors: DUST
 * @LastEditTime: 2023-06-29 10:08:03
 * @FilePath: \vite-project\src\views\browse\website\index.vue
 * @Description: 
 * undefined
-->
<template>
  <browse-page-template>
    <template #banner
      ><!-- banner -->
      <div class="topInfo">
        <div class="detailsHeader">
          <div class="detailsTitle">
            {{ router.currentRoute.value.meta.title }}
          </div>
          <div class="breadcrumb">
            <a-breadcrumb separator=">">
              <a-breadcrumb-item
                v-for="item of pathMap"
                :key="item.meta.key"
                @click="goPath(item.path)"
              >
                {{ item.meta.title }}
              </a-breadcrumb-item>
            </a-breadcrumb>
          </div>
        </div>
      </div>
      <browsePageBanner />
    </template>
    <!-- 内容 -->
    <div class="websiteTypeBox">
      <div class="websiteTypeItem" v-for="item of tableData" :key="item.id">
        <div class="hotNewsTitle">
          <span class="titleText"> {{ item.name }} </span>
        </div>
        <!-- 导航网站内容 -->
        <div class="websiteBox">
          <div class="websiteItem" v-for="website of item.websites" :key="website.id" @click="goBlank(website)">
            <img class="websiteLogo" :src="website.logoUrl" alt="">
            <div class="websiteInfo">
              <div class="websiteName">{{ website.name }}</div>
              <div class="websiteDesc">{{ website.description }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </browse-page-template>
</template>

<script lang="ts" setup>
import Website from "./";
import router from "@/router";
import { websiteInterface } from '../../admin/navigate';

const { tableData, pathMap, goPath } = new Website(router.currentRoute.value);

const goBlank = (website: websiteInterface) => {
  const url = router.resolve({
    path: `/blankWaitting/${website.name}`,
    query: { ...website }
  })

  window.open(url.href, "_blank");
}
</script>

<style lang="less" scoped>
.websiteBox {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  // justify-content: space-between;
  flex-wrap: wrap;
  // padding: 10px 0;
  // box-sizing: border-box;
  margin-top: 20px;
  .websiteItem {
    width: 240px;
    height: 120px;
    box-shadow: 0 0 6px 2px #eee;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    box-sizing: border-box;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 30px;
    margin-bottom: 30px;
    transition: 0.2s;
    &:hover {
      transform: scale(1.1);
    }
    .websiteInfo {
      width: calc(100% - 60px);
      line-height: 35px;
      // padding-top: 20px;
      // box-sizing: border-box;
      .websiteName {
        font-size: 18px;
        font-weight: bold;
      }
      .websiteDesc {
        width: 100%;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        font-size: 14px;
        color: #999;
      }
    }
    .websiteLogo {
      width: 50px;
      height: 50px;
    }
  }
}
</style>
